<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: dio
  Date: 2022/5/5
  Time: 11:56
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" href="css/style.css">
    <link rel="stylesheet" href="css/cart.css">
</head>
<body>
<jsp:include page="header.jsp"/>

<div class="title">
    <h2>我的购物车</h2>
</div>
<div class="container">
    <c:forEach items="${sessionScope.cart.items}" var="item">
    <div class="cart-heard">
        <div class="cart-img"><img src="${pageContext.request.contextPath}${item.goods.image1}" alt=""></div>
        <div class="cart-item">
            <h2>${item.goods.name}</h2>
            <h3><span>单价:￥${item.goods.price}</span></h3>
            <h3><span>数量:${item.number}</span></h3>
            <a href="${pageContext.request.contextPath}/updateCartNumberServlet?id=${item.goods.id}&number=1" class="info">增加</a>
            <a href="${pageContext.request.contextPath}/updateCartNumberServlet?id=${item.goods.id}&number=-1" class="sub">减少</a>
            <a href="${pageContext.request.contextPath}/removeGoodsFromCartServlet?id=${item.goods.id}" class="delete">删除</a>
        </div>
    </div>
    </c:forEach>
    <div class="cart-price">
        <h3>订单总金额:￥${sessionScope.cart.sumMoney}</h3>
        <a href="#" class="submit">提交订单</a>
    </div>
</div>

</body>
</html>
